<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- import CSS -->
 <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
    <div id="app">
        <el-container>
            <el-header>
                <div>
                    <H2>大剧院（极难）</H2>
                    <h5>
                        <a>共有{{list.length}}个角色</a>
                        <a>已有{{cmp}}个角色</a>
                        <a>剩余{{list.length-cmp}}个角色</a>
                    </h5>
                </div>
            </el-header>
            <el-main>
                <el-row>
                    <el-col :span="21"><div class="grid-content bg-purple">
                        <el-input v-model="input" placeholder="请输入扮演角色"></el-input></div>
                    </el-col>
                    <el-col :span="3"><div class="grid-content bg-purple-light">
                        <el-button type="primary" @click="btnadd">添加角色</el-button></div>
                    </el-col>
                  </el-row>
                  <el-row>
                      <el-col :span="24">
                          <div class="grid-content bg-purple-dark">
                            <el-tabs type="border-card">
                                <el-tab-pane label="全部角色">
                                    <div>
                                        <ul>
                                            <li v-for="(v,i) in list" :key="i">
                                                <el-row>
                                                    <el-col :span="22"><div class="grid-content bg-purple">
                                                        <el-checkbox v-model="v.check" ><span :class="v.check?'line-through':''">{{v.name}}</span></el-checkbox>
                                                    </div></el-col>
                                                    <el-col :span="2"><div class="grid-content bg-purple-light">
                                                        <el-button type="text" style="text-align:center;" @click="btndelete(i)">删除</el-button>
                                                    </div></el-col>
                                                  </el-row>
                                            </li>
                                        </ul>
                                    </div>
                                </el-tab-pane>
                                <el-tab-pane label="已有角色">
                                                <div>
                                                    <ul>
                                                        <li v-for="(v,i) in list" :key="i" v-show="v.check">
                                                            <el-row>
                                                                <el-col :span="22"><div class="grid-content bg-purple">
                                                                    <el-checkbox v-model="v.check" ><span :class="v.check?'line-through':''">{{v.name}}</span></el-checkbox>
                                                                </div></el-col>
                                                                <el-col :span="2"><div class="grid-content bg-purple-light">
                                                                    <el-button type="text" style="text-align:center;" @click="btndelete(i)">删除</el-button>
                                                                </div></el-col>
                                                              </el-row>
                                                        </li>
                                                    </ul>
                                                </div>
                                </el-tab-pane>
                                <el-tab-pane label="待选角色">待选角色</el-tab-pane>
                              </el-tabs>
                          </div>
                      </el-col>
                  </el-row>
            </el-main>
          </el-container>
    </div>
</body>
</html>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
    new Vue({
        el:"#app",
        data: {
            input:'',
            checked:true,
            list:[
                {
                    name:"王子",
                    check:false
                },
                {
                    name:"经理",
                    check:false
                },
                {
                    name:"舞者",
                    check:false
                },
                {
                    name:"敲钟人",
                    check:false
                }
            ]
        },
        methods:{
            btndelete(index){
                this.list.splice(index,1)
            },
            btnadd(){
                if(!this.input) return
                this.list.push({name:this.input,
                    check:false
                })
            }
        },
        computed:{
            cmp(){
                return this.list.filter(list => list.check).length
            }
        }
    })
</script>

<style>
    #app {
        width: 800px;
        margin: auto;
    }
    .el-header{
      background-color: #f39e3cfa;
      color: rgb(146, 131, 211);
      text-align: center;
      height: 100px!important;
    }
    
    .el-main {
      background-color: #E9EEF3;
      color: #333;
    }

    .el-row {
    margin-bottom: 10px;
  }
  .el-col {
    border-radius: 4px;
  }
  .bg-purple-dark {
    background: #99a9bf;
  }
  .bg-purple {
    background: #d3dce6;
  }
  .bg-purple-light {
    background: #e5e9f2;
  }
  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }
  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }

  ul {
      list-style-type: none;
  }

  .el-checkbox__label {
    display: inline-block;
    padding-left: 10px;
    line-height: 36px;
    font-size: 14px;
}
  .el-checkbox {
      padding-left: 10px;
  }

  .el-button--text {
      height: 36px;
}

ul li {
    margin: 0;
}

.line-through{
    text-decoration: line-through;
}


  </style>